<?php
include_once("../service/categoryService.php");
?>
<div class="main-body-left">
    <div class="box-head">Danh Mục</div>

    <?php
    $parentCates = getParentCategory();
    while ($parentCate = mysql_fetch_array($parentCates)) {
        echo("<div class='cate-head'>" . $parentCate['CAT_NAME'] . "</div>");
        $childCates = getChildCategory($parentCate['CAT_ID']);
        if (!empty($childCates)) {
            echo("<div class='cate-list'><ul>");
            while ($childCate = mysql_fetch_array($childCates)) {
                ?>
                <li><a href="product.php?cate=<?php echo($childCate['CAT_ID']); ?>" <?php if(isset($cateID) && $cateID == $childCate['CAT_ID']) echo("class='active'");?>><?php echo($childCate['CAT_NAME']); ?></a></li>
                <?php
            }
            echo("</ul></div>");
        }
    }
    ?>

</div>